<template>
  <div class="nav-tab">
    <ul class="tab_3items bdb">
      <li
        @click="tabEvent(index)"
        :class="currentIndex==index?'on':''"
        :key="index"
        v-for="(item,index) in dataList"
      >
        <span>{{item}}</span>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  name: "nav-tab",
  props: {
    dataList: {
      type: Array,
      default: () => {
        return [];
      }
    }
  },
  data() {
    return {
      currentIndex: 0
    };
  },
  methods: {
    tabEvent(index) {
      this.currentIndex = index;
    }
  }
};
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
@import "../../assets/styles/global";
.nav-tab {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  min-width: 200px;
  max-width: 640px;
  background: #F2F4F8;
  .tab_3items {
    display: flex;
    li {
      flex: 1;
      text-align: center;
      span {
        text-align: center;
        font-size: 17px;
        display: inline-block;
        height: 38px;
        line-height: 38px;
        border-bottom: 2px transparent solid;
      }
      &.on {
        span {
          border-color: #009be6;
          color: #009be6;
        }
      }
    }
  }
}
</style>
